import BasicLayout from '@/core/components/layouts/BasicLayout';
import IsAuth from '@/lib/auth/components/IsAuth';
import FinishTempoComponent from '@/lib/pengajuan-tempo/component/FinishTempo';
import { useRouter } from 'next/router';
import axios from 'axios';
import Seo from '@/core/components/Seo';

export async function getServerSideProps(context) {
  const { tempo_id } = context.query;
  await axios.post(
    `${process.env.NEXT_PUBLIC_SELF_HOST}/api/pengajuan-tempo?formId=${tempo_id}`,
    {},
    { headers: context.req.headers }
  );
  return { props: {} };
}

export default function Finish() {
  const router = useRouter();

  return (
    <>
      <Seo title='Penhajuan Tempo Indoteknik.com' />

      <IsAuth>
        <BasicLayout>
          <FinishTempoComponent query={router.query || {}} />
        </BasicLayout>
      </IsAuth>
    </>
  );
}
